<?php

namespace app\common\model;

use think\Model;
use think\Db;

class WithdrawModel extends Model
{
    protected $table = 'zj_withdraw_detail';


    public function getByMerchantId($merchantId)
    {
        $data = WithdrawModel::where(['merchant_id' => $merchantId,'delete_time' => 0])->order('id','desc')->paginate(20);

        return $data;
    }

    /**
     * @todo 查询每日已经提现的金额
     * @return float|int
     */
    public function getDailyWithdrawalAmount()
    {
        $amount = Db::table('zj_withdraw_detail')->whereTime('create_time', 'today')->where('delete_time',0)->sum('withdraw_money');
        return $amount ? $amount : 0;
    }
}

  





 
